<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="css/common.css"/>
	</head>
	<body>
		<div class="content">
			<img class="logo" src="img/logo.jpg"/>
			<h1>需求表单(人物拍摄)</h1>
			<div class="underline"></div>
				
				<div class="time">
					<div class="input_25 fl">
						<span>拍摄时间：&nbsp;&nbsp;&nbsp;</span>
						<span id="film_time" class="border"></span>
					</div>
					
					<div class="input_25 fl">
						<span>费用预算：&nbsp;&nbsp;&nbsp;</span>
						<span id="budget" class="border"></span>
					</div>
					
					<div class="input_25 fl">
						<span>完稿时间：&nbsp;&nbsp;&nbsp;</span>
						<span id="finish_time" class="border"></span>
					</div>
					<div class="clear"></div>
				</div>
				
				<div class="input_25" style="margin-bottom: 50px;">
					<span>供应商推荐:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
					<span id="supplier" class="border"></span>
				</div>
				
				<div class="input_25" style="margin-bottom: 50px;">
					<span>拍摄地点:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
					<span id="filming_location" class="border"></span>
				</div>
				<div class="input_25" style="margin-bottom: 50px; width:50%;">
					<span>模特使用权时间/用途/地区:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
					<span id="model" class="border"></span>
				</div>
				<div class="input_25" style="margin-bottom: 50px;">
					<span>如有修图，修图数量:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
					<span id="xiutu_num" class="border"></span>
				</div>
				<div class="title fl margin_b20">拍摄方案:</div>
				<div id="layout2" class="margin_b20 img_path">
				</div>
				
<!-- 				<div class="title fl">修图标准:</div>
				<div class="fl border" id="content_1"></div> -->
		</div>
		
		<script src="js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			function GetArgsFromHref(sHref, sArgName){
			      var args    = sHref.split("?");
			      var retval = "";
			    
			      if(args[0] == sHref) /*参数为空*/
			      {
			           return retval; /*无需做任何处理*/
			      }  
			      var str = args[1];
			      args = str.split("&");
			      for(var i = 0; i < args.length; i ++)
			      {
			          str = args[i];
			          var arg = str.split("=");
			          if(arg.length <= 1) continue;
			          if(arg[0] == sArgName) retval = arg[1]; 
			      }
			      return retval;
			}
			
			var sn = GetArgsFromHref(window.location.href,'sn');

			$.ajax({
				type:"post",
				url:'./app/index.php?m=public&a=detail',
				data:{'sn':sn},
				success:function(ret){
					$("#film_time").html(ret.detail.film_time);
					$("#budget").html(ret.detail.budget);
					$("#finish_time").html(ret.detail.finish_time);
					$("#supplier").html(ret.detail.supplier);
					$("#filming_location").html(ret.detail.filming_location);
					$("#model").html(ret.detail.expand_model);
					$("#xiutu_num").html(ret.detail.expand_xiutu_num);
					var layout2 = ret.detail.file.layout2
					var layout_html = "";
					
					function is_img(upFileName){
						var index1=upFileName.lastIndexOf(".");
						var index2=upFileName.length;
						var suffix=upFileName.substring(index1+1,index2);//后缀名
						var img_ext = "jpg,gif,png,jpeg"; 
						if (suffix.indexOf(img_ext) >=0){
							return true
						}
						return false;
					}
					
					
					for(var i in layout2){
						var is_img = is_img(layout2[i].path);
						if (is_img) {
							layout_html = "<img class='' src='."+layout2[i].path+"' style='margin-right:0;margin-left:20px'><a href='"+layout2[i].download+"'>点击下载图片</a>";
						}else{
							layout_html = "<a href='"+layout2[i].download+"'>点击下载附件["+i+"]</a>";
						}
						$("#layout2").prepend(layout_html)
					}
				}
			});
			

		</script>
	</body>
</html>